//
//  CZBaseTableViewController.swift
//  Weibo
//
//  Created by 董松 on 16/2/26.
//  Copyright © 2016年 董松. All rights reserved.
//

import UIKit
//UITableViewController  微博四个模块都是以列表形式展示

class CZBaseTableViewController: UITableViewController ,CZVisitorDelegate{

    //父类定义一个属性，子类可以访问
    var visitor: CZVisitor?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        visitor = CZVisitor()
        
        visitor?.delegate = self
//        vistor?.startAnimation()
        
        view = visitor
        //设置nav
        setupNav()
    }
    
    private func setupNav(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "didRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "didLogin")
    }
    
    func didLogin() {
        
    }
    
    func didRegister() {
        print("控制器 代理回调")
        
        let login = CZLoginViewController()
        
        let nav = UINavigationController(rootViewController: login)
        
        presentViewController(nav, animated: true) { () -> Void in
        }
    }

}
